/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package org.testis.wirelesssecuritymodule.services;

import org.testis.data.TestStepException;
import org.testis.data.TestStepResultType;
import org.testis.services.AtofModuleAction;
import org.testis.services.AtofModuleActionFactory;
import org.testis.testdriver.AtofEnumaration.AtofWirelessModuleAction;


/**
 *
 * @author root
 */
public class WirelessSecurityModuleActionFactory extends AtofModuleActionFactory {

    @Override
    public AtofModuleAction getActionObject(String actionType) {
        AtofWirelessModuleAction action;
        try {
            action = AtofWirelessModuleAction.valueOf(actionType);
        } catch (IllegalArgumentException ex) {

            throw new TestStepException(TestStepResultType.MISTAKE,
                                        "Action type given " + actionType +
                                        " not found for WirelessSecurityModuleActionFactory Application ..." +
                                        ex.getMessage());
        }
        AtofModuleAction actionObj = null;
        if (action == AtofWirelessModuleAction.PrepareWpaConf) {
            actionObj = new WirelessSecurityModulePrepareWpaConfAction();
        }
        else if (action == AtofWirelessModuleAction.ConnectWirelessAndVerify) {
            actionObj = new WirelessSecurityModuleConnectWirelessAndVerify();
        }
        else if (action == AtofWirelessModuleAction.DisconnectWireless) {
            actionObj = new WirelessSecurityModuleDisconnectWireless();
        }
        else {
            throw new TestStepException(TestStepResultType.ERROR,
                                        "Action type given " + actionType +
                                        " not found for WirelessSecurityModuleActionFactory ..." +
                                        "No given method found");
        }
        return actionObj;

    }
}
